
import wx

class MainFrame(wx.Frame):
    def __init__(self):
        super().__init__(None, title="数字图像处理与Python实现示例", size=(800, 600))

        # 创建主面板
        panel = wx.Panel(self)

        # 创建垂直布局器
        main_sizer = wx.BoxSizer(wx.VERTICAL)

        # 添加空白区域用于居中
        main_sizer.AddStretchSpacer()

        # 创建10个按钮
        for i in range(10):
            if i == 0:
                btn = wx.Button(panel, label="采样与量化(模拟)")
                btn.Bind(wx.EVT_BUTTON, self.on_sampling_click)
            else:
                btn = wx.Button(panel, label="未实现")
                btn.Bind(wx.EVT_BUTTON, self.on_button_click)
            main_sizer.Add(btn, 0, wx.ALL | wx.CENTER, 10)

        # 添加空白区域用于居中
        main_sizer.AddStretchSpacer()

        # 创建底部布局器用于放置作者信息
        bottom_sizer = wx.BoxSizer(wx.HORIZONTAL)
        bottom_sizer.AddStretchSpacer()

        # 作者信息标签
        author_label = wx.StaticText(panel, label="作者：岭南小白")
        bottom_sizer.Add(author_label, 0, wx.ALL, 10)

        # 将底部布局器添加到主布局器
        main_sizer.Add(bottom_sizer, 0, wx.EXPAND)

        # 设置面板布局器
        panel.SetSizer(main_sizer)

        # 窗口居中显示
        self.Center()

    def on_button_click(self, event):
        wx.MessageBox("暂未实现该功能", "提示", wx.OK | wx.ICON_INFORMATION)

    def on_sampling_click(self, event):
        from sampling import SamplingFrame
        frame = SamplingFrame()
        frame.Show()

class MainApp(wx.App):
    def OnInit(self):
        frame = MainFrame()
        frame.Show()
        return True

if __name__ == '__main__':
    app = MainApp()
    app.MainLoop()
